Update test_group_4 to include changing state after rollback#13
Open
qirh wants to merge 1 commit intoPaulLockett:mainfrom
Open
Update test_group_4 to include changing state after rollback#13qirh wants to merge 1 commit intoPaulLockett:mainfrom
qirh wants to merge 1 commit intoPaulLockett:mainfrom
Conversation
As mentioned in this issue (PaulLockett#8). I think there is a bug in the test file for level 4. This is the order of operations: ["FILE_UPLOAD_AT", "2021-07-01T12:00:00", "Initial.txt", "100kb"], ["FILE_UPLOAD_AT", "2021-07-01T12:05:00", "Update1.txt", "150kb", 3600], ["FILE_GET_AT", "2021-07-01T12:10:00", "Initial.txt"], ["FILE_COPY_AT", "2021-07-01T12:15:00", "Update1.txt", "Update1Copy.txt"], ["FILE_UPLOAD_AT", "2021-07-01T12:20:00", "Update2.txt", "200kb", 1800], ["ROLLBACK", "2021-07-01T12:10:00"], ["FILE_GET_AT", "2021-07-01T12:25:00", "Update1.txt"], ["FILE_GET_AT", "2021-07-01T12:25:00", "Initial.txt"], ["FILE_SEARCH_AT", "2021-07-01T12:25:00", "Up"], ["FILE_GET_AT", "2021-07-01T12:25:00", "Update2.txt"]
alexbleakley
suggested changes
Apr 21, 2025
| def test_group_4(self): | ||
| output = simulate_coding_framework(self.test_data_4) | ||
| self.assertEqual(output, ["uploaded at Initial.txt", "uploaded at Update1.txt", "got at Initial.txt", "copied at Update1.txt to Update1Copy.txt", "uploaded at Update2.txt", "rollback to 2021-07-01T12:10:00", "got at Update1.txt", "got at Initial.txt", "found at [Update1.txt, Update1Copy.txt, Update2.txt]", "got at Update2.txt"]) | ||
| self.assertEqual(output, ["uploaded at Initial.txt", "uploaded at Update1.txt", "got at Initial.txt", "copied at Update1.txt to Update1Copy.txt", "uploaded at Update2.txt", "rollback to 2021-07-01T12:10:00", "got at Update1.txt", "got at Initial.txt", "found at [Update1.txt, Update1Copy.txt]", "file not found"]) |
There was a problem hiding this comment.
This is still incorrect. Update1Copy.txt should not be in the result for the search operation either, because it was copied at 2021-07-01T12:15:00, and then deleted in the rollback to 2021-07-01T12:10:00.
There was a problem hiding this comment.
Suggested change
| self.assertEqual(output, ["uploaded at Initial.txt", "uploaded at Update1.txt", "got at Initial.txt", "copied at Update1.txt to Update1Copy.txt", "uploaded at Update2.txt", "rollback to 2021-07-01T12:10:00", "got at Update1.txt", "got at Initial.txt", "found at [Update1.txt, Update1Copy.txt]", "file not found"]) | |
| self.assertEqual(output, ["uploaded at Initial.txt", "uploaded at Update1.txt", "got at Initial.txt", "copied at Update1.txt to Update1Copy.txt", "uploaded at Update2.txt", "rollback to 2021-07-01T12:10:00", "got at Update1.txt", "got at Initial.txt", "found at [Update1.txt]", "file not found"]) |
Indeed, Update1Copy.txt should also not appear in the search result, since it was uploaded at 12:15, and the rollback was to 12:10.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As mentioned by others in Issue #8, I believe there is a bug in the test file for Level 4.
Order of Operations
["FILE_UPLOAD_AT", "2021-07-01T12:00:00", "Initial.txt", "100kb"]["FILE_UPLOAD_AT", "2021-07-01T12:05:00", "Update1.txt", "150kb", 3600]["FILE_GET_AT", "2021-07-01T12:10:00", "Initial.txt"]["FILE_COPY_AT", "2021-07-01T12:15:00", "Update1.txt", "Update1Copy.txt"]["FILE_UPLOAD_AT", "2021-07-01T12:20:00", "Update2.txt", "200kb", 1800]["ROLLBACK", "2021-07-01T12:10:00"]["FILE_GET_AT", "2021-07-01T12:25:00", "Update1.txt"]["FILE_GET_AT", "2021-07-01T12:25:00", "Initial.txt"]["FILE_SEARCH_AT", "2021-07-01T12:25:00", "Up"]["FILE_GET_AT", "2021-07-01T12:25:00", "Update2.txt"]Issue
After step 6 (ROLLBACK), the file
Update2.txtshould not exist because it was uploaded at2021-07-01T12:20:00, which is after the rollback timestamp2021-07-01T12:10:00.Since the system is rolled back to the state as of
2021-07-01T12:10:00, any files uploaded after this timestamp should no longer exist. However, the test case appears to assumeUpdate2.txtis still accessible after the rollback, which contradicts the expected behavior.